library(interflex)
library(haven)
library(dplyr)
library(sjmisc)
library(ggplot2)
library(interplot)


main_recoded_for_R <- read_dta("main_recoded.dta")
recoded.df <- as.data.frame(dat)


#binning
interflex(Y = "electionconfidenceindex", D = "factchecks", X = "pid7recodedleanersasparty", data = recoded.df, 
          estimator = "binning", vcov.type = "robust", na.rm = TRUE,  Xlabel="Party ID", main = "Election Confidence, by Treatment and Party \n(Binning Estimator)"
)

#kernel
interflex(Y = "electionconfidenceindex", D = "factchecks", X = "pid7recodedleanersasparty", data = recoded.df, 
          estimator = "kernel", na.rm = TRUE, Xlabel="Party ID", main = "Election Confidence, by Treatment and Party \n(Kernel Estimator)")

